package main

import "ObserverPattern/Observer"

func main() {
	var ob1 *Observer.Observer = &Observer.Observer{ObserverName: "观察者1"}
	var ob2 *Observer.Observer = &Observer.Observer{ObserverName: "观察者2"}

	var notifier *Observer.Notifier = Observer.NewNotifier("消息分发器1")

	notifier.AddObserver(ob1)
	notifier.AddObserver(ob2)

	var mess1 *Observer.Message = &Observer.Message{Content: "开始交易"}
	var mess2 *Observer.Message = &Observer.Message{Content: "有内鬼，终止交易"}

	notifier.NotifyAll(mess1)
	notifier.NotifyAll(mess2)
}
